package com.cjack.frenchexcel.config;

import io.swagger.annotations.ApiModelProperty;
import lombok.AllArgsConstructor;
import lombok.Data;
import lombok.NoArgsConstructor;

import java.util.List;
import java.util.Objects;

@Data
@NoArgsConstructor
@AllArgsConstructor
public class LayPage {
    //返回分页数据
    private Integer code = 0;
    private Integer count;
    private List data;

    public static final Integer DEFAULT_PAGE = 1;
    public static final Integer DEFAULT_LIMIT = 10;

    @ApiModelProperty("本次获取的数据的页数，从第一页开始，默认值1")
    private Integer page;
    @ApiModelProperty("每页展示的数据条数,默认值为10")
    private Integer limit;

    public void setPage(Integer page) {
        this.page = Objects.isNull(page) ? DEFAULT_PAGE : page;
    }

    public void setLimit(Integer limit) {
        this.limit = Objects.isNull(limit) ? DEFAULT_LIMIT : limit;
    }
}
